home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE="VBScript" %>
- <%
- Option Explicit
-
- Dim dtToday
- dtToday = Date()
-
- Dim dtCurViewMonth ' First day of the currently viewed month
- Dim dtCurViewDay ' Current day of the currently viewed month
-
- %>
-
-
- <% REM This section defines functions to be used later on. %>
- <% REM This sets the Previous Sunday and the Current Month %>
- <%
-
- '--------------------------------------------------
- Function DtPrevSunday(ByVal dt)
- Do While WeekDay(dt) > vbSunday
- dt = DateAdd("d", -1, dt)
- Loop
- DtPrevSunday = dt
- End Function
- '--------------------------------------------------
-
- %>
-
- <%REM Set current view month from posted CURDATE, or
- ' the current date as appropriate.
-
- ' if posted from the form
- ' if prev button was hit on the form
- If InStr(1, Request.Form, "subPrev", 1) > 0 Then
- dtCurViewMonth = DateAdd("m", -1, Request.Form("CURDATE"))
- ' if next button was hit on the form
- ElseIf InStr(1, Request.Form, "subNext", 1) > 0 Then
- dtCurViewMonth = DateAdd("m", 1, Request.Form("CURDATE"))
- ' anyother time
- Else
- dtCurViewMonth = DateSerial(Year(dtToday), Month(dtToday), 1)
- End If
- %>
-
-
- <% REM --------BEGINNING OF DRAW CALENDAR SECTION-------- %>
- <% REM This section executes the event query and draws a matching calendar. %>
- <%
- Dim iDay, iWeek, sFontColor
- %>
-
- <HTML>
- <HEAD>
- </HEAD>
- <BODY>
-
- <BR>
-
- <CENTER>
- <FORM NAME="fmNextPrev" ACTION="calendar.asp" METHOD=POST>
- <TABLE CELLPADDING=3 CELLSPACING=0 WIDTH="95%" BORDER=2 BGCOLOR="#99CCFF" BORDERCOLORDARK="#003399" BORDERCOLORLIGHT="#FFFFFF">
- <TR VALIGN=MIDDLE ALIGN=CENTER>
- <TD COLSPAN=7>
- <TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%" BORDER=0>
- <TR VALIGN=MIDDLE ALIGN=CENTER>
- <TD WIDTH="30%" ALIGN=RIGHT>
- <INPUT TYPE=IMAGE NAME="subPrev" SRC="Left.gif" BORDER=0 WIDTH=18 HEIGHT=20 HSPACE=0 VSPACE=0>
- </TD>
- <TD WIDTH="40%">
- <FONT FACE="Arial" COLOR="#000000">
- <B><%=MonthName(Month(dtCurViewMonth)) & " " & Year(dtCurViewMonth)%></B>
- </FONT>
- </TD>
- <TD WIDTH="30%" ALIGN=LEFT>
- <INPUT TYPE=IMAGE NAME="subNext" SRC="Right.gif" BORDER=0 WIDTH=18 HEIGHT=20 HSPACE=0 VSPACE=0>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
-
- <TR VALIGN=TOP ALIGN=CENTER BGCOLOR="#000099">
-
- <% For iDay = vbSunday To vbSaturday %>
- <TH WIDTH="14%"><FONT FACE="Arial" SIZE="-2" COLOR="#FFFFFF"><%=WeekDayName(iDay)%></FONT></TH>
- <%Next %>
-
- </TR>
-
- <%
- dtCurViewDay = DtPrevSunday(dtCurViewMonth)
-
- For iWeek = 0 To 5
- Response.Write "<TR VALIGN=TOP>" & vbCrLf
-
- For iDay = 0 To 6
- Response.Write "<TD HEIGHT=50>"
-
- If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
- If dtCurViewDay = dtToday Then
- sFontColor = "#FF3300"
-
- Else
- sFontColor = "#000000"
- End If
-
- '---- Write day of month
-
- Response.Write "<FONT FACE=""Arial"" SIZE=""-2"" COLOR=""" & sFontColor & """><B>"
- Response.Write Day(dtCurViewDay) & "</B></FONT><BR>"
-
- '---Else
- '---Response.Write "รก"
- End If
-
- Response.Write "</TD>" & vbCrLf
- dtCurViewDay = DateAdd("d", 1, dtCurViewDay)
- Next
- Response.Write "</TR>" & vbCrLf
- Next
- %>
- <%REM --------END OF DRAW CALENDAR SECTION-------- %>
- </TABLE>
- <INPUT TYPE=HIDDEN NAME="CURDATE" VALUE="<%=dtCurViewMonth%>">
- </FORM>
- </CENTER>
- </BODY>
- </HTML>
-